package com.bryanbibat.flashcards.spring;

public class Settings {

  private Integer choices;
  private Integer rounds;
  private Integer penalty;
  
  public int getChoices() {
    return choices == null || choices < 2 ? 3 : choices;
  }
  
  public void setChoices(int choices) {
    this.choices = choices;
  }
  
  public int getRounds() {
    return rounds == null || rounds < 0 ? 10 : rounds;
  }
  
  public void setRounds(int rounds) {
    this.rounds = rounds;
  }

  public int getPenalty() {
    return penalty == null || penalty < 1 ? 1 : penalty;
  }
  
  public void setPenalty(int penalty) {
    this.penalty = penalty;
  }

  public String getURLParams() {
    StringBuffer sb = new StringBuffer("?");
    sb.append("choices=").append(getChoices()).append("&");
    sb.append("rounds=").append(getRounds()).append("&");
    sb.append("penalty=").append(getPenalty());
    return sb.toString();
  }


  
}
